package gameCreation;

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JTextArea;
import javax.swing.JLabel;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class FinalJeopardyEditor {

	JFrame frame;
	GameCreator theGame;

	/**
	 * Create the application.
	 */
	public FinalJeopardyEditor(GameCreator gc) {
		theGame = gc;
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frame = new JFrame();
		frame.setBounds(100, 100, 425, 356);
		frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		frame.getContentPane().setLayout(null);
		
		JTextArea txtQuestion = new JTextArea(theGame.finalQuestion);
		txtQuestion.setBounds(10, 27, 389, 112);
		frame.getContentPane().add(txtQuestion);
		
		JLabel lblQuestion = new JLabel("Question:");
		lblQuestion.setBounds(10, 11, 102, 14);
		frame.getContentPane().add(lblQuestion);
		
		JLabel lblAnswer = new JLabel("Answer:");
		lblAnswer.setBounds(10, 150, 46, 14);
		frame.getContentPane().add(lblAnswer);
		
		JTextArea txtAnswer = new JTextArea(theGame.finalAnswer);
		txtAnswer.setBounds(10, 168, 389, 112);
		frame.getContentPane().add(txtAnswer);
		
		final GameCreator f_TheGame = theGame;
		final JTextArea f_txtQuestion = txtQuestion;
		final JTextArea f_txtAnswer = txtAnswer;
		final JFrame thisFrame = this.frame; 
		JButton btnDone = new JButton("Done");
		btnDone.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				f_TheGame.finalQuestion = f_txtQuestion.getText();
				f_TheGame.finalAnswer = f_txtAnswer.getText();
				thisFrame.dispose();
			}
		});
		btnDone.setBounds(310, 291, 89, 23);
		frame.getContentPane().add(btnDone);
		
		
	}
}
